package com.example.bijiabao.servicesImpl;

import com.example.bijiabao.entity.book;
import com.example.bijiabao.mapper.BookMapper;
import com.example.bijiabao.services.BookServices;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServicesImpl implements BookServices {
    @Autowired
    private BookMapper bookMapper;


    @Override
    public List<book> getAllBook() {
        List<book> list = bookMapper.getAllBook();
        return list;
    }

    @Override
    public PageInfo<book> findbookById1(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById1();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public PageInfo<book> findbookById3(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById3();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public PageInfo<book> findbookById2(Integer num2) {
//        return bookMapper.findbookById2();
        PageHelper.startPage(num2,12);
        List<book> lists = bookMapper.findbookById2();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }


    @Override
    public PageInfo<book> findbookById4(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById4();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public PageInfo<book> findbookById5(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById5();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public PageInfo<book> findbookById6(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById6();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public PageInfo<book> findbookById7(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById7();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public PageInfo<book> findbookById8(Integer num) {
        PageHelper.startPage(num,12);
        List<book> lists = bookMapper.findbookById8();
        PageInfo<book> pageInfo= new PageInfo<>(lists);
        return pageInfo;
    }
}
